#!/usr/bin/env python3
# encoding: utf-8
from rpc import *
from rpc import func


def RPC_server_start(ip, port):
    print("-- start rpc --")
    funcs = [i for i in func.__dir__() if not i.startswith("__")]
    handler = RPCHandler()
    [ handler.register_function(getattr(func, func_name)) for func_name in funcs]
    rpc_server(handler, (ip, int(port)), authkey=b'hello')

if __name__ == "__main__":                                                                    
    RPC_server_start("localhost", 17000)

